package game.gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ResourceBundle;

import javax.swing.*;

/**
 * @author Aqilah
 * Class WonDialog displays won dialog when user wins a game
 */
public class WonDialog extends JDialog implements ActionListener{
	
	/** Constructor */
	public WonDialog(JFrame parent){
		super(parent, true);
		createGUI();
	}
	
	/** Create GUI for the dialog */
	public void createGUI(){
		setTitle("You Won!");
		setLayout(null);
		JLabel label = new JLabel("Congratulations... You Won!");
		label.setBounds(30, 20, 200, 30);
		add(label);
		
		JButton btnExit = new JButton("Exit");
		btnExit.setBounds(80, 55, 60, 30);
		btnExit.addActionListener(this);
		add(btnExit);
		
		setBounds(100, 100, 250, 140);
		
		// update labels
		ResourceBundle rb = ResourceBundle.getBundle("languages.MessagesBundle", getParent().getLocale());
		label.setText(rb.getString("congratulations"));
		setTitle(rb.getString("youwon"));
	}

	/** Implement ActionListener interface */
	public void actionPerformed(ActionEvent arg0) {
		setVisible(false);	
	}

}
